package it.afs.wicket;

import org.apache.wicket.datetime.DateConverter;
import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter;

/**
 * Formatter basato su pattern.
 * 
 * @author Fanta
 *
 */
public class PatternDateConverter extends DateConverter
{
	private static final long serialVersionUID = 5755918733316132250L;
	
	private String datePattern;
	
	public PatternDateConverter(String datePattern) {
		super(true);
		this.datePattern = datePattern;
	}

	@Override
	public String getDatePattern() {
		return datePattern;
	}

	@Override
	protected DateTimeFormatter getFormat() {
		return DateTimeFormat.forPattern(datePattern);
	}

}
